// 实现这个项目的构建任务
const fs = require('fs')
const {Transform} = require('stream')

exports.default = () => {

  const readStream = fs.createReadStream('src/assets/styles/main.scss')
  const writeStream = fs.createWriteStream('src/assets/styles/main.min.scss')
  const transform = new Transform({
    transform: (chunk, encoding, callback) => {
      const input = chunk.toString()
      const output = input.replace(/\s+/g, '').replace('/\/\*+?\*\//g', '')
      callback(null, output)
    }
  })
  readStream
    .pipe(transform)
    .pipe(writeStream)
  return readStream
}


